package com.yun.config;

import com.yun.util.MyLocalResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;



/*拓展springMvc，如果要手动制作一些功能，在这里配置，springBoot会自动装配*/
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("main");
        registry.addViewController("/main.html").setViewName("main");
        registry.addViewController("/login.html").setViewName("login");
    }

    /*注册我们的国际化组件*/
    @Bean
    public LocaleResolver localeResolver(){
        return new MyLocalResolver();
    }


}
